local yongguan = fk.CreateSkill{
  name = "kl__yongguan",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["kl__yongguan"] = "勇冠",
  [":kl__yongguan"] = "锁定技，①你的攻击范围+1，你不会被翻面，你的阶段不能被跳过，你成为【杀】的额外目标或多目标牌的非唯一目标时取消之。"..
  "<br>②结束阶段，你摸一张牌，若你没有手牌则改为摸两张。",

  ["$kl__yongguan1"] = "趁势争利，所得远胜遵礼守义。",
  ["$kl__yongguan2"] = "时合当取之，岂能踌躇不行？",
}

yongguan:addEffect("atkrange", {
  correct_func = function (self, from, to)
    if from:hasSkill(yongguan.name) then
      return 1
    end
  end,
})

yongguan:addEffect(fk.BeforeTurnOver, {
  anim_type = "defensive",
  on_use = function(self, event, target, player, data)
    data.prevented = true
  end,
})

yongguan:addEffect(fk.EventPhaseSkipping, {
  anim_type = "defensive",
  on_use = function(self, event, target, player, data)
     data.skipped = false
  end,
})

yongguan:addEffect(fk.TargetConfirming, {
  anim_type = "defensive",
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(yongguan.name) and not data.cancelled and (data.card.trueName == "slash" or (data.card.multiple_targets)) then
      local skill = data.card.skill
      local ret
      if skill.target_num then
        ret = skill.target_num
      else
        ret = skill.max_target_num
      end
      if type(ret) == "function" then
        ret = ret(skill, data.from, data.card)
      end
      --来自CardSkill:getMaxTargetNum
      return (ret < #data.use.tos and data.card.trueName == "slash") or (data.card.multiple_targets and #data.use.tos ~= 1)
    end
  end,
  on_use = function(self, event, target, player, data)
    data:cancelCurrentTarget()
  end,
})

yongguan:addEffect(fk.EventPhaseStart, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(yongguan.name) and player.phase == Player.Finish
  end,
  on_use = function(self, event, target, player, data)
    player:drawCards(player:isKongcheng() and 2 or 1, yongguan.name)
  end,
})


return yongguan

